package com.xiashitech.agent.instrumentation.apachehttpclient.v4.inst;

import com.xiashitech.agent.instrumentation.apachehttpclient.common.v4.HttpClientHeaderGetter;
import com.xiashitech.agent.instrumentation.base.propagator.W3CReentryBaggagePropagator;
import com.xiashitech.agent.instrumentation.bridge.Java8Bridge;
import org.apache.http.HttpResponse;

public final class ApacheHttpClientHelper {

  public static void dealReentryValue(Object result) {
    if(result != null && result instanceof HttpResponse) {
      W3CReentryBaggagePropagator.getInstance().extract(Java8Bridge.currentForXSContext(), (HttpResponse)result, HttpClientHeaderGetter.INSTANCE).makeCurrent();
    } else {
      //dealed in WrappingStatusSettingResponseHandler
    }
  }

  private ApacheHttpClientHelper() {}
}
